let navLi = document.querySelectorAll(".nav-item")
let li = document.querySelectorAll("#nav-list .nav-link")
let searchE = document.querySelector('.search input')
let searchBut = document.querySelector('.searchLogo')



navLi.forEach(item => {
	item.onmousemove = function(){
		let ul = item.getElementsByTagName('ul')[0]
		if (ul !== undefined){
			ul.style.display = 'block'
		}
	}
	
	item.addEventListener('mouseout', () => {
		let ul = item.getElementsByTagName('ul')[0]
		if (ul !== undefined){
			ul.style.display = "none"
		}
	})
})


window.addEventListener('resize', () => {
	if (document.body.offsetWidth <= 1200) {
		li.forEach(item => {
			item.className = "nav-link px-3"
		})
	}else {
		li.forEach(item => {
			item.className = "nav-link px-4"
		})
	}
})


searchBut.addEventListener('click', function () {
	let str = searchE.value
	let reS = new RegExp("^[ ]+$")
	console.log(str === '')
	if (reS.test(str) || str === '') {
		alert('请输入查询内容')
	}
})


$('.showImage').slick({
	prevArrow: "",
	nextArrow: "",
	autoplaySpeed: 1000,
	dots: false,
	infinite: true,
	speed: 300,
	autoplay: true,
	slidesToShow: 1,
	slidesToScroll: 1,
	responsive: [
		{
			breakpoint: 1024,
			settings: {
				slidesToShow: 1,
				slidesToScroll: 1,
				infinite: true,
				dots: false
			}
		},
		{
			breakpoint: 992,
			settings: {
				slidesToShow: 2,
				slidesToScroll: 2
			}
		},
		{
			breakpoint: 480,
			settings: {
				slidesToShow: 1,
				slidesToScroll: 1
			}
		}
	]
});


